<%@ page import="java.util.Date" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <title>日期格式化</title>
</head>
<body>
<%
    Date date = new Date();
//    String s = date.getYear() + "年" + (date.getMonth() + 1) + "月" + date.getDate() + "日"
//            +"  "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
    //需要对日期时间进行格式化，传入的值de类型是Date类，不能是其他格式
    session.setAttribute("nowTime", date);
    String str="Java-Python-PHP";
    session.setAttribute("lang", str);
    Map<Integer,Integer> map=new HashMap<>();
    map.put(111, 111);
    map.put(111, 111);
    map.put(333, 333);
    map.put(444, 444);
    map.put(555, 555);
    session.setAttribute("map", map);

%>
<input type="text" value="<fmt:formatDate value="${nowTime}" pattern="MM-dd HH:ss" type="both"></fmt:formatDate>">
<%--function功能函数标签  主要用于操作字符串--%>
<div>
    Java之后的内容：${fn:substringAfter(lang, "Java")}<br>
    PHP之前的内容：${fn:substringBefore(lang, "PHP")}<br>
    ${fn:containsIgnoreCase(lang, "Java")}<br>
    ${fn:length(lang)}<br>
    ${fn:join(fn:split(lang,"-" ),"," )}<br>
    ${fn:length(map)}<br>

</div>
</body>
</html>
